package com.dream.cgomall.controller;

import com.dream.cgomall.dto.AttributeDTO;
import com.dream.cgomall.service.CgoAttributeService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.*;

import java.util.List;
import java.util.Map;

@RestController
@RequestMapping("Attr")
public class CgoGoodAttribute {
    @Autowired
    private CgoAttributeService cgoAttributeService;
    @RequestMapping("/SelAttr/{id}")
    public List<AttributeDTO> selectOneAttribute(@PathVariable("id") int goodid){
         return cgoAttributeService.selectOneAll(goodid);
    }
    @RequestMapping("/SelTwo/{color}/{id}")
    public List<AttributeDTO> selectTwoAttribute(@PathVariable("color") String oneAttr, @PathVariable("id") int goodid){
        System.out.println(oneAttr);
        return cgoAttributeService.selectTwoAll(oneAttr, goodid);
    }
    @RequestMapping("/SelView/{id}")
    public List<AttributeDTO> selectViewAttribute(@PathVariable("id") int goodid){
        System.out.println(goodid);
        return cgoAttributeService.selectTwoAll1(goodid);
    }
}
